<template>
  <div>
    <el-row style="margin-left: 0px; margin-right: 0px;">
      <el-col :span="10">
        <h1>用户注册</h1>
        <el-form :model="user" label-width="120px">
          <el-form-item label="用户名">
            <el-input v-model="user.name" />
          </el-form-item>
          <el-form-item label="身份证号码">
            <el-input v-model="user.idNumber" />
          </el-form-item>
          <el-form-item label="年龄">
            <el-input v-model="user.age" />
          </el-form-item>
          <el-form-item label="手机号码">
            <el-input v-model="user.mobile" />
          </el-form-item>
          <el-form-item label="性别">
            <el-radio-group v-model="user.sex">
              <el-radio label="男"></el-radio>
              <el-radio label="女"></el-radio>
            </el-radio-group>
          </el-form-item>
          <el-form-item label="职业">
            <el-input v-model="user.occupation" />
          </el-form-item>
          <el-form-item label="家庭住址">
            <el-input v-model="user.homeAddress" />
          </el-form-item>

          <el-form-item>
            <el-button type="primary" @click="doRegister">注册</el-button>
          </el-form-item>
        </el-form>
      </el-col>
    </el-row>
  </div>
</template>

<script>
/* eslint-disable */
// 单独引入ElMessageBox
import { MessageBox } from 'element-ui'
import axios from 'axios'

export default {
  name: 'register',
  data(){
    return  {
      user: {
        name: null,
        age: null,
        idNumber: null,
        mobile:null,
        sex:null,
        occupation:null,
        homeAddress:null
      }
    }
  },
  methods: {
    doRegister() {
      //使用axios进行数据提交
      axios.post("/api/customer-center/customerRegister",this.user).then(
          (res) => {
            this.user = {};
            MessageBox.alert('注册成功!', '用户注册');
          }
      )
    }
  }
}
</script>

<style>
</style>

